graph theory:loop